﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Dominio;

namespace HotelGUI
{
    public partial class ListadoClientes : Form
    {
        private Sistema s = Sistema.getInstance();

        public ListadoClientes()
        {
            InitializeComponent();
            List<string[]> lst = new List<string[]>();
            lst = s.traerClientes();
            foreach (string[] l in lst)
            {
                ListViewItem item = lvClientes.Items.Add(l[0]);
                item.SubItems.Add(l[1]);
                item.SubItems.Add(l[2]);
            }
    
        }

        private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                string id = lvClientes.SelectedItems[0].SubItems[0].Text;
                string nom = lvClientes.SelectedItems[0].SubItems[1].Text;
                string ape = lvClientes.SelectedItems[0].SubItems[2].Text;
               ((Reservas)this.Owner).setCliente(id, nom, ape);
               this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        
    }
}
